package adminejb;

import java.util.HashMap;
import java.util.Map;

import javax.ejb.LocalBean;
import javax.ejb.Stateful;

import validator.ValidationService;

/**
 * Session Bean implementation class CityStatefulBeanLocal
 */
@Stateful
@LocalBean
public class CityStatefulBean implements CityStatefulBeanLocal {

	Map<String, String> map;
	
	public CityStatefulBean() {
		map = new HashMap<String, String>();
	}
	
	public Map<String, String> getMap() {
		return map;
	}

	public void clearMap() {
		this.map.clear();

	}

	public void validateCityName(String value) {
		try {
			ValidationService.countryNameValidation(value);
		} catch (validator.ValidationException fe) {
			map.put("countryname", fe.getMessage());
		}
	}

	public void validateCityCode(String value) {
		try {
			ValidationService.countryCodeValidation(value);
		} catch (validator.ValidationException fe) {
			map.put("countrycode", fe.getMessage());
		}
	}

}
